package fallingGame;

/**
 * <p>
 * Title: Brick
 * </p>
 * <p>
 * Description: CS 343 Course Project Brick is a GameObject that acts as an
 * enemy in the game.
 * </p>
 * 
 * @author Nathanial Howard, Joe Costello, Dustin Schwingle, Jared Potter
 * @email nathanial.howard@my.uwrf.edu, anthony.costello@my.uwrf.edu,
 *        dustin.schwingle@my.uwrf.edu, jared.potter@my.uwrf.edu
 * @date December 01, 2011
 * @team Group 2
 */
public class Brick extends GameObject {

	/**
	 * Brick
	 * 
	 * default constructor
	 * 
	 * @ensure Brick's width, height, x coordinate, and y coordinate will be
	 *         initialized
	 */
	public Brick() {
		// GameObject constructor
		super();
		setWidth(16);
		setHeight(8);
		setY(-getHeight());
		setActive(true);
	}

	/**
	 * spawn
	 * 
	 * reset the values of the Brick to be above the playing field. this method
	 * spawns the brick at a random x value within the playing field.
	 * 
	 * @ensure the brick will be set at the top of the screen with a random x
	 *         coordinate
	 */
	public void spawn() {

		// set it above the map
		setY(-getHeight());
		setY_vel(1.0f);

		// place it randomly in a horizontal manner
		setX((float) Math.random() * 418 + 186);
	}
}
